package simulador;

public class Job {
	private boolean flag, ok;
	private long iterations;
	int recurso;
	private double timeBorn;

	public Job(int recurso, long iterations, double timeBorn) {
		this.recurso = recurso;
		this.iterations = iterations;
		this.timeBorn = timeBorn;
	}

	void decrementaIteracao() {
		if (this.iterations > 0) {
			this.iterations--;
			if (this.iterations < 0)
				setOk(true);
		}
	}

	/**
	 * @return the flag
	 */
	public boolean isFlag() {
		return flag;
	}

	/**
	 * @param flag
	 *            the flag to set
	 */
	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	/**
	 * @return the ok
	 */
	public boolean isOk() {
		if (!ok)
			if (this.iterations < 1)
				ok = true;
		return ok;
	}

	/**
	 * @param ok
	 *            the ok to set
	 */
	public void setOk(boolean ok) {
		this.ok = ok;
	}

	/**
	 * @return the iterations
	 */
	public long getIterations() {
		return iterations;
	}

	/**
	 * @return the recurso
	 */
	public int getRecurso() {
		return recurso;
	}

	/**
	 * @return the timeBorn
	 */
	public double getTimeBorn() {
		return timeBorn;
	}
}
